<?php

namespace EasyVote\EasyVoteBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;


/**
 * The Vote class represents a vote for an option in an election.
 *
 * @ORM\Entity()
 */
class Vote
{
    use ORMBehaviors\Timestampable\Timestampable;

    /**
     * Stores the id of this vote.
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * Stores the user associated with this vote.
     * If null, it is assumed that this is a profile of something other than
     * a person running for political office.
     * @var User
     * @ORM\ManyToOne(targetEntity="User")
     */
    private $user;

    /**
     * Stores the profile associated with this vote.
     * @var Profile
     * @ORM\ManyToOne(targetEntity="Profile")
     */
    private $profile;

    /**
     * Stores the weight of this vote.
     * @var float
     * @ORM\Column(name="weight", type="float")
     */
    private $weight;

    /**
     * @return mixed
     */
    public function getElection()
    {
        return $this->election;
    }

    /**
     * @param mixed $election
     */
    public function setElection($election)
    {
        $this->election = $election;
    }

    /**
     * Stores the election that this belongs to.
     * @var Election
     * @ORM\ManyToOne(targetEntity="Election")
     */
    private $election;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Sets the user that cast the vote.
     * @param User $user
     */
    public function setUser(User $user)
    {
        $this->user = $user;
    }

    /**
     * Sets the profile that the user is voting for.
     * @param Profile $profile
     */
    public function setProfile(Profile $profile)
    {
        $this->profile = $profile;
    }

    /**
     * Sets the weight of the vote. Currently only votes of weight 1 are supported.
     * @param $weight
     */
    public function setWeight($weight)
    {
        $this->weight = $weight;
    }

    /**
     * Gets the user that cast the vote.
     * @return User
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Gets the profile the user is voting for
     * @return Profile
     */
    public function getProfile()
    {
        return $this->profile;
    }

    /**
     * Gets the weight of this vote.
     * @return float
     */
    public function getWeight()
    {
        return $this->weight;
    }
}

?>
